//
//  FieldDetailBottomView.m
//  BaseProject
//
//  Created by 王洋 on 2020/7/24.
//  Copyright © 2020 王洋. All rights reserved.
//

#import "FieldDetailBottomView.h"

@implementation FieldDetailBottomView

- (void)awakeFromNib {
    [super awakeFromNib];
    
    [self.storeControl addGestureTapEventHandle:^(id  _Nonnull sender, UITapGestureRecognizer * _Nonnull gestureRecognizer) {
        if (self.FieldDetailBottomViewBlock) {
            self.FieldDetailBottomViewBlock(FieldDetailBottomType_store);
        }
    }];
    
    [self.collectControl addGestureTapEventHandle:^(id  _Nonnull sender, UITapGestureRecognizer * _Nonnull gestureRecognizer) {
        if (self.FieldDetailBottomViewBlock) {
            self.FieldDetailBottomViewBlock(FieldDetailBottomType_collect);
        }
    }];
    
    [self.imControl addGestureTapEventHandle:^(id  _Nonnull sender, UITapGestureRecognizer * _Nonnull gestureRecognizer) {
        if (self.FieldDetailBottomViewBlock) {
            self.FieldDetailBottomViewBlock(FieldDetailBottomType_im);
        }
    }];
    
    [self.phoneControl addGestureTapEventHandle:^(id  _Nonnull sender, UITapGestureRecognizer * _Nonnull gestureRecognizer) {
        if (self.FieldDetailBottomViewBlock) {
            self.FieldDetailBottomViewBlock(FieldDetailBottomType_call);
        }
    }];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self.checkSheduleBtn pp_clipCorners:UIRectCornerAllCorners radius:self.checkSheduleBtn.frame.size.height/2];
        [self.submitOrderBtn pp_clipCorners:UIRectCornerAllCorners radius:self.submitOrderBtn.frame.size.height/2];
    });
    self.phoneControl.hidden = YES;
    self.submitOrderBtn.hidden = YES;
    self.checkSheduleBtn.right = self.submitOrderBtn.right;
}

- (IBAction)checkScheduleAction:(id)sender {
    if (self.FieldDetailBottomViewBlock) {
        self.FieldDetailBottomViewBlock(FieldDetailBottomType_schedule);
    }
}

- (IBAction)orderAction:(id)sender {
    if (self.FieldDetailBottomViewBlock) {
        self.FieldDetailBottomViewBlock(FieldDetailBottomType_order);
    }
}

@end
